package com.supreme.cacheserver.config.condition;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.env.Environment;
import org.springframework.core.type.AnnotatedTypeMetadata;

public class DoubleCacheCondition implements Condition {

    @Override
    public boolean matches(ConditionContext conditionContext, AnnotatedTypeMetadata metadata) {
        Environment environment = conditionContext.getEnvironment();
        String cacheTypeProperty = environment.getProperty("cache-server.cacheType", "NONE");
        return cacheTypeProperty.equalsIgnoreCase("caffeine");
    }
}
